#!/bin/sh
cp /etc/emailT1 /tmp/email.tmp
echo From: $1 >>/tmp/email.tmp
cat /etc/emailB1>>/tmp/email.tmp
iw dev wlan0 scan trigger
echo ">>>>> iw dev wlan0 scan dump <<<<<" >> /tmp/email.tmp
iw dev wlan0 scan dump >> /tmp/email.tmp
echo ">>>>> iw dev wlan0 survey dump <<<<<" >> /tmp/email.tmp
iw dev wlan0 survey dump >> /tmp/email.tmp
echo ">>>>> cat /var/dhcp.leases <<<<<" >> /tmp/email.tmp
cat /var/dhcp.leases >> /tmp/email.tmp
echo ">>>>> arp <<<<<" >> /tmp/email.tmp
arp >> /tmp/email.tmp
mailhost=$(echo "$1" | cut -f2 -d"@" | cut -f1 -d".")
ssmtp -C/etc/ssmtp/ssmtp-${mailhost}.conf -v -au$1 -ap$2 -t </tmp/email.tmp
rm /tmp/email.tmp
